package com.sau.pixelcart.mapper;

import com.sau.pixelcart.domain.entity.Product;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 商品核心信息表 Mapper 接口
 * </p>
 *
 * @author Inton
 * @since 2025-03-16
 */
@Mapper
public interface ProductMapper extends BaseMapper<Product> {

    /**
     * 修改商品状态
     * @param id
     * @param status
     */
    @Update("update product set status = #{status} where id = #{id}")
    void changeStatus(@Param("id") String id, @Param("status") String status);

    /**
     * 修改商品库存
     * @param productList
     */
    void updateStockNum(@Param("productList") List<Product> productList);
}
